home *** CD-ROM | disk | FTP | other *** search
/ PC User 2002 April / Disc 2 / PCUSER0402D2.iso / software / utils / files / wincron.exe / data1.cab / Sample_Scripts / sendkeys_basic_test.tg < prev    next >
Encoding:
Text File  |  2001-10-20  |  1010 b   |  42 lines

  1. ## sendkeys_basic_test
  2. # This script demonstrates the SendKeys features.
  3. # SendKeys will send a series of keystrokes to the foreground window.
  4. # The format of the SendKeys command uses the same structure as the Visual Basic SendKeys
  5. {
  6.     -name sendkeys_basic_test
  7.     -start -delay 0 0 0 5
  8.     -action -onerror operation_fail
  9.  
  10.     # find the window - exception if not found
  11.     -action -findWindow hwnd "Hello.*Notepad" _
  12.  
  13.     # set the foreground window - exception on error
  14.     -action -setForegroundWindow hwnd
  15.  
  16.     # type some text
  17.     -action -sendkeys sendkeys "Hello World!"
  18.  
  19.     # get file menu / SaveAs
  20.     -action -sendkeys sendkeys "%(fa)"
  21.  
  22.     # type the file name
  23.     -action -sendkeys sendkeys "c:\temp\Hello.txt"
  24.  
  25.     # hit the 'S'ave
  26.     -action -sendkeys sendkeys "%s"
  27.  
  28.     # hit the 'Y'es
  29.     -action -sendkeys sendkeys "%y"
  30.  
  31.     -action -inc 0 0 0 5
  32.  
  33. }
  34.  
  35. # operation failed
  36. {
  37.     -name operation_fail
  38.     -action -print SendKeys test failed with error:
  39.     -action -print %TG.LAST_ERROR%
  40.     -action -return break
  41. }
  42.